package com.dkm.biz.gl.repository.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.gl.domain.GlDic;
import com.dkm.biz.gl.persistence.dao.GlDicQueryDao;
import com.dkm.biz.gl.persistence.entity.GlDicPo;
import com.dkm.biz.gl.repository.GlDicRepository;
import com.dkm.biz.repository.AbstractRepository;

/**
 * 对象功能:数据字典 Repository接口的实现类
 * 开发公司:SKG.COM
 * 开发人员:Yuki
 * 创建时间:2015-01-10 17:42:39
 */
@Repository
public class GlDicRepositoryImpl extends AbstractRepository<String, GlDicPo,GlDic> implements GlDicRepository{
	  
	@Resource
	private  GlDicQueryDao glDicQueryDao;

	public GlDic newInstance() {
		GlDicPo po = new GlDicPo();
		GlDic glDic = SpringHelper.getBean(GlDic.class);
		glDic.setData(po);
		return glDic;
	}

	public GlDic newInstance(GlDicPo po) {
		GlDic glDic = SpringHelper.getBean(GlDic.class);
		glDic.setData(po);
		return glDic;
	} 
	
	@Override
	protected IQueryDao<String, GlDicPo> getQueryDao() {
		return glDicQueryDao;
	}

	@Override
	public List<GlDicPo> findByCateKey(String cateKey) {
		Map<String,	Object> params=new HashMap<String, Object>();
		params.put("cateKey", cateKey);
		return glDicQueryDao.findByKey("findByCateKey", params);
	}

	@Override
	public GlDicPo findByCateKeyAndLabel(String cateKey, String label) {
		Map<String,	Object> params=new HashMap<String, Object>();
		params.put("cateKey", cateKey);
		params.put("label", label);
		return glDicQueryDao.getByKey("findByCateKeyAndLabel", params);
	}

	@Override
	public GlDicPo findByCateKeyAndValue(String cateKey, String value) {
		Map<String,	Object> params=new HashMap<String, Object>();
		params.put("cateKey", cateKey);
		params.put("value", value);
		return glDicQueryDao.getByKey("findByCateKeyAndValue", params);
	}

	@Override
	public List<GlDicPo> findByCommmentNotNone() {
		// TODO Auto-generated method stub
		return glDicQueryDao.findByKey("findByCommmentNotNone",null);
	}

	@Override
	public List<GlDicPo> getLogicsValidList() {
		
		return glDicQueryDao.findByKey("findLogicsValidList",null);
	}
	
	
	
}
